<?php

namespace app\admin\model;

use think\Model;


class Withdraw extends Model
{

    

    

    // 表名
    protected $name = 'withdraw';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'withdraw_type_text',
        'status_text',
        'platform_text'
    ];
    

    
    public function getWithdrawTypeList()
    {
        return ['wechat' => __('Withdraw_type wechat'), 'alipay' => __('Withdraw_type alipay')];
    }

    public function getStatusList()
    {
        return ['-1' => __('Status -1'), '0' => __('Status 0'), '1' => __('Status 1'), '2' => __('Status 2')];
    }

    public function getPlatformList()
    {
        return ['H5' => __('Platform h5'), 'WechatOfficialAccount' => __('Platform wechatofficialaccount'), 'WechatMiniProgram' => __('Platform wechatminiprogram'), 'App' => __('Platform app')];
    }


    public function getWithdrawTypeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['withdraw_type']) ? $data['withdraw_type'] : '');
        $list = $this->getWithdrawTypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getStatusTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
        $list = $this->getStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getPlatformTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['platform']) ? $data['platform'] : '');
        $list = $this->getPlatformList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}
